|
|
|
|
|
|
|
The AutoGenSQVOpen Method |
|
|
|
|
|
|
|
|
Now add the AutoGenSQVOpen subroutine from Listing A.30. Notice that, if no name is supplied for the script, SQL-VB5 invents one based on the MDB name. |
|
|
|
|
|
|
|
|
Listing A.30. Coding the AutoGenSQVOpen subroutine. |
|
|
|
|
|
|
|
|
Public Sub AutoGenSQVOpen(Optional cSQV As Variant)
On Error GoTo AutoGenSQVOpenErr
'
Dim intTemp As Integer
'
If IsMissing(cSQV) = True Or Len(cSQV) = 0 Then
cWrFile = cDBName
Else
cWrFile = cSQV
End If
'
intTemp = InStr(cWrFile, ".")
If intTemp > 0 Then
cWrFile = Mid(cWrFile, 1, intTemp - 1)
End If
cWrFile = cWrFile + ".sqv"
'
If IsMissing(cSQV) = True Or Len(cSQV) = 0 Then
SQLVBMain.CommonDialog1.DialogTitle = "Create SQV File"
SQLVBMain.CommonDialog1.DefaultExt = "SQV"
SQLVBMain.CommonDialog1.Filter = "SQV Script File|*.SQV"
SQLVBMain.CommonDialog1.filename = cWrFile
SQLVBMain.CommonDialog1.Flags = cdlOFNCreatePrompt Or
cdlOFNOverwritePrompt
SQLVBMain.CommonDialog1.CancelError = True
SQLVBMain.CommonDialog1.ShowOpen
cWrFile = SQLVBMain.CommonDialog1.filename
End If
'
If Len(cWrFile) = 0 Then
intGlobalErr = True
Else
nWrFile = FreeFile
Open cWrFile For Output As nWrFile
End If
GoTo AutoGenSQVOpenExit
'
AutoGenSQVOpenErr:
If Err <> 32755 Then
ErrMsg Err, Error$, intLine, strLine, "AutoGenDBOpen"
End If
intGlobalErr = True
'
AutoGenSQVOpenExit:
'
End Sub |
|
|
|
|
|